package com.mm.dss.demo.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.mm.dss.demo.R;


public class LogoutDialog extends Dialog {

    private TextView yes, no, titleTv;
    private String tltMsg, yesStr, noStr;
    private View.OnClickListener YesOnclick, NoOnclick;
    private int YesTextColor = R.color.hl_6x3, NoTextColor = R.color.hl_6x3, TltTextColor = R.color.hl_6x3;
    private Context mContext;

    public LogoutDialog(Context context) {
        super(context, R.style.PriceChangeDialog);
        this.mContext = context;

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_logout);
        //按空白处不能取消动画
        setCanceledOnTouchOutside(false);
        //初始化界面控件
        initView();

    }


    /**
     * 初始化界面控件
     */
    private void initView() {
        yes = (TextView) findViewById(R.id.tvDialogOk);
        no = (TextView) findViewById(R.id.tvDialogCancel);
        titleTv = (TextView) findViewById(R.id.tvTlt);



        no.setText(noStr);
        titleTv.setText(tltMsg);
        yes.setText(yesStr);
        no.setTextColor(mContext.getResources().getColor(NoTextColor));
        titleTv.setTextColor(mContext.getResources().getColor(TltTextColor));
        yes.setTextColor(mContext.getResources().getColor(YesTextColor));
        no.setOnClickListener(NoOnclick);
        yes.setOnClickListener(YesOnclick);
    }


    /**
     * 取消文字
     *
     * @param noStr
     */
    public void setNoStr(String noStr) {
        this.noStr = noStr;

    }

    /**
     * 取消字体颜色
     *
     * @param color
     */
    public void setNoTextColor(int color) {
        this.NoTextColor = color;

    }

    /**
     * 提示文字
     *
     * @param tltMsg
     */
    public void setTltMsg(String tltMsg) {
        this.tltMsg = tltMsg;

    }

    /**
     * 提示字体颜色
     *
     * @param color
     */
    public void setTltTextColor(int color) {
        this.TltTextColor = color;
    }

    /**
     * 确定文字
     *
     * @param yesStr
     */
    public void setYesStr(String yesStr) {
        this.yesStr = yesStr;

    }

    /**
     * 确定字体颜色
     *
     * @param color
     */
    public void setYesTextColor(int color) {
        this.YesTextColor = color;
    }

    /**
     * 确定按钮点击事件
     */
    public void setYesOnclickListener(View.OnClickListener clickListener) {
        this.YesOnclick = clickListener;

    }

    /**
     * 取消按钮点击事件
     */
    public void setNoOnclickListener(View.OnClickListener clickListener) {
        this.NoOnclick = clickListener;
    }

}
